<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue-2.6.12开发.js"></script>
</head>

<body>
    <!-- 
        v-for指令:
             1.用于展示列表数据
             2.语法:v-for="(item,index) in xxx " :key="index"
             3.可遍历:数组、对象、字符串、指定次数
             3.可遍历:数组、对象、字符串、指定次数
     -->
    <ul id="root">
        <!-- 1.遍历数组 经常用-->
        <!-- <li v-for="(p,index) in perms" :key="index">{{p.name}}-{{p.age}}</li> -->

        <!-- 2.遍历对象 常用-->
        <!-- <li v-for="(val,k) in car" :key="k">{{k}}-{{val}}</li> -->

        <!-- 3.遍历字符串 比较少-->
        <!-- <li v-for="(char,index) in str">{{index}}-{{val}}</li> -->

        <!-- 4.遍历指定次数 非常少-->
        <li v-for="(number,index) in 5">{{index}}-{{number}}</li>

    </ul>
    <script>
        const vm = new Vue({
            el: '#root',
            data: {
                perms: [
                    {
                        id: 001,
                        name: '刘亦菲',
                        age: 20
                    },
                    {
                        id: 002,
                        name: '陈宝莲',
                        age: 21
                    },
                    {
                        id: 003,
                        name: '许晴',
                        age: 22
                    }
                ],
                car: {
                    brand: '凌志',
                    model: 'Rs300',
                    color: '灰色'
                },
                str: 'LYFWD'
            }
        })
    </script>
</body>

</html>